  
import React from "react";
import ReactDOM from "react-dom";
import "antd/dist/antd.css";
import actions from "@/shared/actions";

import "./public-path";
import App from "./App.jsx";

function render(props = {}) {
  if (props && window.__POWERED_BY_QIANKUN__) {
    // 注入 actions 实例
    actions.setActions(props);
  }
  ReactDOM.render(<App />, document.getElementById('root'));
}

if(!window.__POWERED_BY_QIANKUN__) {
  render();
}

export async function bootstrap() {
  console.log("ReactMicroApp bootstraped");
}

export async function mount(props) {
  console.log("ReactMicroApp mount", props);
  render(props);
}

export async function unmount() {
  console.log("ReactMicroApp unmount");  
  ReactDOM.unmountComponentAtNode(document.getElementById("root"));
}
